<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <title>${requestScope.course.cname}学生管理|河海大学实践课程考勤系统</title>
    <jsp:include page="head.jsp"/>
</head>
<body>
<div class="container">
    <jsp:include page="header.jsp"/>
    <div class="row">
        <div class="col-sm-offset-1 col-sm-2">
            <ul class="nav nav-pills nav-stacked">
                <li><a href="${pageContext.request.contextPath}/teacher/index">主页</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/info">个人信息</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/addcourse">添加课程</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/logout">退出登录</a></li>
            </ul>
        </div>
        <div class="col-sm-offset-1 col-sm-6">
            <p><a class="btn btn-info btn-sm"
                  href="${pageContext.request.contextPath}/teacher/course?cid=${requestScope.course.cid}">返回课程</a>
                <a class="btn btn-info btn-sm"
                   href="${pageContext.request.contextPath}/teacher/student?cid=${requestScope.course.cid}">刷新页面</a></p>
            <h3>${requestScope.course.cname}：学生管理</h3>
            <a class="btn btn-default btn-block"
               href="${pageContext.request.contextPath}/teacher/addstudent?cid=${requestScope.course.cid}">添加学生</a>
            <h4>学生列表</h4>
            <p id="msg" class="text-danger text-center">${requestScope.msg}</p>
            <table class="table">
                <thead>
                <tr>
                    <th>学号<small>（点击查看签到记录）</small></th>
                    <th>姓名</th>
                    <th>删除学生</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${requestScope.students}" var="student">
                    <tr>
                        <td>
                            <a href="${pageContext.request.contextPath}/teacher/query?cid=${requestScope.course.cid}&sid=${student.sid}">${student.sid}</a>
                        </td>
                        <td>${student.sname}</td>
                        <td>
                            <form action="${pageContext.request.contextPath}/teacher/student?cid=${requestScope.course.cid}"
                                  method="post">
                                <input type="hidden" name="sid" value="${student.sid}">
                                <input class="btn btn-danger" type="submit" value="删除">
                            </form>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
    <jsp:include page="footer.jsp"/>
</div>
</body>
</html>
